package com.pipi.sso.dao.manager.impl;

import com.pipi.sso.dao.manager.DormitoryRoomManager;
import com.pipi.sso.dao.mapper.ext.DormitoryRoomExtMapper;
import com.pipi.sso.dao.model.DormitoryRoomDO;
import com.pipi.sso.dao.query.DormitoryRoomQuery;
import com.pipi.sso.dao.support.PageResult;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * Manager for DormitoryRoom.
 */

@Component
public class DormitoryRoomManagerImpl implements DormitoryRoomManager {

    
    @Autowired
    protected DormitoryRoomExtMapper dormitoryRoomExtMapper;
    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(DormitoryRoomQuery query){
        return dormitoryRoomExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(DormitoryRoomQuery query){
        return dormitoryRoomExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(DormitoryRoomDO record){
        return dormitoryRoomExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(DormitoryRoomDO record){
        return dormitoryRoomExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<DormitoryRoomDO> selectByQuery(DormitoryRoomQuery query){
        return dormitoryRoomExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
    */
    @Override
    public PageResult<DormitoryRoomDO> selectByQueryWithPage(DormitoryRoomQuery query) {
        PageResult<DormitoryRoomDO> result = new PageResult<DormitoryRoomDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public DormitoryRoomDO selectByPrimaryKey(Long id){
        return dormitoryRoomExtMapper.selectByPrimaryKey(id);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective( DormitoryRoomDO record,  DormitoryRoomQuery query){
        return dormitoryRoomExtMapper.updateByQuerySelective(record,  query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery( DormitoryRoomDO record,  DormitoryRoomQuery query){

        return dormitoryRoomExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(DormitoryRoomDO record){
        return dormitoryRoomExtMapper.updateByPrimaryKeySelective(record);
    }
}